Skip to content

test(cloudflare): Add integration test infrastructure #16848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Jul 8, 2025

I tried using cloudflare:test and the wrangler vitest pool but with the config it doesn't appear like there's an easy way to have more than one wrangler config. This isn't very useful if you want to add lots of different tests with different wrangler configurations!

After much frustration and attempts I decided to just copy the Node integration test runner and strip out all the stuff we didn't need. This took less time than I'd already spend messing around. I debated making the test runners use shared code but quickly discounted that because of how little actually ends up being shared.

This PR:

  • Moves createBasicSentryServer from the Node integration test to @sentry-internal/test-utils so it can be used by both
  • Added dev-packages/cloudflare-integration-tests/ with all the basic files it needs
  • Create a simplified test runner that runs wrangler in dev mode
    • spawn('wrangler', ['dev', '--config', wranglerConfigPath, '--var', 'SENTRY_DSN:${SENTRY_DSN}']);
  • Adds a simple test for throwing in the fetch handler which asserts the entire envelope
  • Adds the new test project to CI

@AbhiPrasad AbhiPrasad requested review from a team, mydea, msonnb and AbhiPrasad and removed request for a team July 8, 2025 18:37
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

timfish added 2 commits July 9, 2025 19:05
…m:getsentry/sentry-javascript into timfish/test/cloudflare-integration-tests
cursor[bot]

This comment was marked as outdated.

completed: async function (): Promise<void> {
return isComplete;
},
makeRequest: async function <T>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, maybe it could be possible to have a WS method also?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I guess we'll add more options when we add tests that need it!

Co-authored-by: 0xbad0c0d3 <[email protected]>
cursor[bot]

This comment was marked as resolved.

@timfish timfish mentioned this pull request Jul 10, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants